//
//  TicketImgCell.swift
//  ANOA
//
//  Created by 邱仙凯 on 2018/11/12.
//  Copyright © 2018 zwb. All rights reserved.
//

import UIKit

class TicketImgCell: BaseTicketCell ,KSImageUtilDelegate {
    
    func addImages(_ util: KSImageSelectUtil, imgs: [UIImage]) {
        self.addAction!(imgs)
    }
    
    func deleteImage(_ util: KSImageSelectUtil, index: Int) {
        self.deleteAction!(index)
        self.imageUtil?.deleteLocalImg(tag: index)
    }
    
    
    
    var imageUtil:KSImageSelectUtil?
    var deleteAction:((Int)->())?
    var addAction:(([UIImage])->())?
    var viewOnly = false {
        didSet {
            let viewFlag:ImgViewType = viewOnly ? .viewOnly : .editable
            
            imageUtil = KSImageSelectUtil(frame:CGRect(x:0,y:5,width:bgW ,height:110),httpHeader: USERINFO.picUrl.unwrap,maxImgCount: 1,numberOfRow:4,viewType:viewFlag)
            imageUtil!.ksDelegate = self
            imageUtil!.setLineHidden(true)
            bg.addSubview(imageUtil!)
        }
    }
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        
       
    }
    
    
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    

}
